import { getRepository, UpdateResult } from 'typeorm';
import { QyUser } from '@/entity/qy-user.entity';
import { UpdateUserProps } from '@interfaces/users.interface';

class UserService {
  public user = QyUser;

  async updateUserId(user: UpdateUserProps): Promise<UpdateResult> {
    const userRepository = getRepository(this.user);
    const res = await userRepository.update(
      {
        userId: user.userId,
        corpId: user.corpId,
      },
      {
        userId: user.newUserId,
      },
    );
    return res;
    //  await userRepository
  }
}

export default UserService;
